﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace QuanLyKhachSan
{
    public partial class UC_Phong_Edit : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    LoaiPhong_Load();
                    TienNghi_Load();
                }
            }
            catch (Exception ex)
            {                
                throw ex;
            }
        }
        /// <summary>
        /// LoaiPhong_Load
        /// </summary>
        protected void LoaiPhong_Load()
        {
            try
            {
                cbxLoaiPhong.DataSource = LoaiPhongBLL.LoaiPhong_GetItems();
                cbxLoaiPhong.DataTextField = "LoaiPhongName";
                cbxLoaiPhong.DataValueField = "LoaiPhongID";
                cbxLoaiPhong.DataBind();
            }
            catch (Exception ex)
            {                
                throw ex;
            }
        }
        /// <summary>
        /// TienNghi_Load
        /// </summary>
        protected void TienNghi_Load()
        {
            try
            {
                cbxTienNghi.DataSource = TienNghiBLL.TienNghi_GetItems();
                cbxTienNghi.DataTextField = "TienNghiName";
                cbxTienNghi.DataValueField = "TienNghiID";
                cbxTienNghi.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        protected void cmdOK_Click(object sender, EventArgs e)
        {
            try
            {
                PhongBLL.Phong_Add(int.Parse(cbxLoaiPhong.SelectedValue.ToString()), txtTenPhong.Text,int.Parse(cbxTienNghi.SelectedValue.ToString()),  int.Parse(txtSoGiuong.Text.ToString()), int.Parse(txtSoNguoi.Text.ToString()));
            }
            catch (Exception ex)
            {                
                throw;
            }
        }
}
}
